package data.coursedata;

import java.util.ArrayList;

import po.CoursePO;

public class CourseUtil {

	public static ArrayList<CoursePO> transList(ArrayList<String> list) {
		ArrayList<CoursePO> ret = new ArrayList<CoursePO>();
		String[] split = null;
		CoursePO cpo = null;
		for (String l : list) {
			split = l.split("\\|");
			cpo = new CoursePO(split[0], split[1], split[2], split[3],
					split[4], split[5], split[6], split[7], split[8], split[9],
					split[10], split[11]);
			cpo.setIntroduction(split[12]);
			ret.add(cpo);
		}
		return ret;
	}

	public static String[] POtoArray(CoursePO cpo) {
		String[] ret = { cpo.getNumber(), cpo.getName(), cpo.getInstitute(),
				cpo.getTime(), cpo.getLocation(), cpo.getTeacher(),
				cpo.getCredit(), cpo.getTA(), cpo.getRequire(),
				cpo.getPopulation(), cpo.getModule(), cpo.getTerm(),
				cpo.getIntroduce() };
		return ret;
	}

}
